import request from './request'

export function newTopic(data:any) {
    return request({
        url: '/forum/topic',
        method: 'post',
        data
    })
}

export function searchTopicList(data:any, page:number, pageSize:number) {
    return request({
        url: '/forum/topic/search?page='+page+'&pageSize='+pageSize,
        method: 'post',
        data
    })
}

export function likeTopic(id:number) {
    return request({
        url: '/forum/topic/like/' + id,
        method: 'post'
    })
}

export function disLikeTopic(id:number) {
    return request({
        url: '/forum/topic/dislike/' + id,
        method: 'post'
    })
}

export function collectTopic(id:number) {
    return request({
        url: '/forum/topic/collect/' + id,
        method: 'post'
    })
}

export function cancelCollectTopic(id:number) {
    return request({
        url: '/forum/topic/cancelCollect/' + id,
        method: 'post'
    })
}

export function lockTopic(id:number) {
    return request({
        url: '/forum/topic/lock/' + id,
        method: 'post'
    })
}

export function unlockTopic(id:number) {
    return request({
        url: '/forum/topic/unlock/' + id,
        method: 'post'
    })
}

export function deleteTopic(id:number) {
    return request({
        url: '/forum/topic/delete/' + id,
        method: 'post'
    })
}

export function newContent(data:any) {
    return request({
        url: '/forum/content',
        method: 'post',
        data
    })
}

export function searchContentList(data:any, page:number, pageSize:number) {
    return request({
        url: '/forum/content/search?page='+page+'&pageSize='+pageSize,
        method: 'post',
        data
    })
}

export function likeContent(id:number) {
    return request({
        url: '/forum/content/like/' + id,
        method: 'post'
    })
}

export function disLikeContent(id:number) {
    return request({
        url: '/forum/content/dislike/' + id,
        method: 'post'
    })
}

export function newReply(data:any) {
    return request({
        url: '/forum/reply',
        method: 'post',
        data
    })
}

export function getReplyList(contentId: number, page:number, pageSize: number) {
    return request({
        url: '/forum/reply/list?contentId=' + contentId + "&page=" + page + "&pageSize=" + pageSize,
        method: 'get'
    })
}